//
//  SuggestTableViewCell.m
//  History
//
//  Created by 七 on 16/9/6.
//  Copyright © 2016年 kane. All rights reserved.
//

#import "SuggestTableViewCell.h"

@implementation SuggestTableViewCell
@synthesize BGView,detailTV,detailTF,detailLbl,coverLbl;
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
    if (self) {
        BGView = [[UIView alloc]initWithFrame:self.frame];
        BGView.backgroundColor = KKColor_DarkGray_White;
        [self.contentView addSubview:BGView];
        detailTV = [[UITextView alloc] initWithFrame:CGRectMake(30, 0, 260, 100)];
        detailTV.delegate = self;
        detailTV.textColor = [UIColor darkGrayColor];
        detailTV.font = [UIFont systemFontOfSize:14];
        detailTV.backgroundColor = KKColor_DarkGray_White;
        [BGView addSubview:detailTV];
        coverLbl = [[UILabel alloc] initWithFrame:CGRectMake(35, 0, 260, 65)];
        coverLbl.font = [UIFont systemFontOfSize:14];
        coverLbl.numberOfLines = 3;
        coverLbl.textColor = [UIColor lightGrayColor];
        coverLbl.backgroundColor = KKColor_DarkGray_White;
        coverLbl.alpha = 0.7;
        [BGView addSubview:coverLbl];
        detailTF = [[UITextField alloc] initWithFrame:CGRectMake(30, 0, 260, 40)];
        detailTF.font = [UIFont systemFontOfSize:12];
        detailTF.textColor = [UIColor darkGrayColor];
        UIColor *color = [UIColor lightGrayColor];
        detailTF.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"留下QQ、邮箱或电话" attributes:@{NSForegroundColorAttributeName: color}];
        detailTF.backgroundColor = KKColor_DarkGray_White;
        [BGView addSubview:detailTF];
        detailLbl = [[UILabel alloc] initWithFrame:CGRectMake(30, 0, 260, 64)];
        detailLbl.font = [UIFont systemFontOfSize:12];
        detailLbl.numberOfLines = 2;
        detailLbl.textColor = [UIColor lightGrayColor];
        detailLbl.backgroundColor = KKColor_DarkGray_White;
        [BGView addSubview:detailLbl];
        
    }
    return self;
    
}


- (void)loadSuggestView:(NSDictionary*)dict
{
    if ([dict[@"row"] isEqualToString:@"1"]) {
        [detailTF setHidden:YES];
        [detailLbl setHidden:YES];
    }else if([dict[@"row"] isEqualToString:@"2"]){
        [detailTV setHidden:YES];
        [detailLbl setHidden:YES];
        [coverLbl setHidden:YES];
    }else{
        [detailTV setHidden:YES];
        [detailTF setHidden:YES];
        [coverLbl setHidden:YES];
    }
    
    detailLbl.text = @"上述内容仅对[一点资讯]工作人员可见，可帮我们更快与你沟通并解决问题。";
    detailTF.placeholder = @"留下QQ、邮箱或电话";
    coverLbl.text = @"请简单描述你所遇到的问题或建议，还可添加QQ或微信账号2218158520与我们及时沟通哟~";
}


#pragma mark - UITextView Delegate
- (void)textViewDidChange:(UITextView *)textView
{
    if ([textView.text isEqualToString:@""]) {
        [coverLbl setHidden:NO];
    }else{
        [coverLbl setHidden:YES];
    }
}
@end
